<template>
  <div class="sellp">
    <el-table :data="tableData" height="600" style="width: 80%">
      <el-table-column prop="zhanghao" label="用户账号" width="140" />
      <el-table-column prop="nicheng" label="用户昵称" width="140" />
      <el-table-column prop="leijishuimianshichang" label="累计睡眠时长" width="140" />
      <el-table-column prop="leijishenshuishichang" label="累计深睡时长" width="140" />
      <el-table-column prop="leijiqianshuishichang" label="累计浅睡时长" width="140" />
      <el-table-column prop="leijiqingxingshichang" label="累计清醒时长" width="140" />
      <el-table-column prop="address" label="Address">
        <template #default="scope">
          <el-button link type="primary" size="small" @click.prevent="chakan(scope.row)">查看明细</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script lang='ts' setup>
import { computed, ref, onMounted } from "vue";
import { push_sleep } from "../../stores/counter";
import { useRouter } from "vue-router";
const router = useRouter();
const store = push_sleep();

let tableData = ref([]);

onMounted(() => {
  tableData.value = store.filterTableData;
});

const chakan = () => {
  router.push({
    path: "/maxindex/sleepreader/",
    query: { id: JSON.stringify(tableData.value) },
  });
};
</script>

<style lang='scss' scoped>
.sellp {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
}
</style>